Crate xmltree[][src]

A simple library for parsing an XML file into an in-memory tree structure

Not recommended for large XML files, as it will load the entire file into memory.

Example

use xmltree::Element;
use std::fs::File;

let data: &'static str = r##"
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<names>
    <name first="bob" last="jones" />
    <name first="elizabeth" last="smith" />
</names>
"##;

let mut names_element = Element::parse(data.as_bytes()).unwrap();

println!("{:#?}", names_element);
{
    // get first `name` element
    let name = names_element.get_mut_child("name").expect("Can't find name element");
    name.attributes.insert("suffix".to_owned(), "mr".to_owned());
}
names_element.write(File::create("result.xml").unwrap());

Structs

Element

Represents an XML element.

EmitterConfig

Emitter configuration structure.

Namespace

Namespace is a map from prefixes to namespace URIs.

Enums

Error

An error which may be returned by XmlWriter when writing XML events.

ParseError

Errors that can occur parsing XML

XMLNode

Traits

ElementPredicate

A predicate for matching elements.